package com.stqf.scala.grammar.io

import scala.io.{BufferedSource, Source}

/**
  * Created by ASUS on 2018-01-31.
  */
object LinboHu {
  def main(args: Array[String]): Unit = {
    var source = Option.empty[BufferedSource]
    try {
      source = Option(Source.fromFile(ClassLoader.getSystemResource("app.properties").toURI,"utf-8"))
      //source = Option(Source.fromFile("C:\\\\Users\\\\ASUS\\\\Desktop\\\\Main.scala"))
      /*val sb = new StringBuilder()
      for (line <- source.get.getLines()) {
        sb.append(line.trim).append("\n")
      }
      println(sb.toString)*/

      println(source.get.mkString)
      //你自己的逻辑
    } catch {
      case e: Exception => e.printStackTrace()
    } finally {
      if (source.isDefined) {
        source.get.close()
      }
    }
  }


}
